import { ElNotification, ElMessageBox } from "element-plus";

export const toast = (title, message, dangerouslyUseHTMLString, type, showClose) => {
  ElNotification({
    title: title || '登录成功',
    message: message || "",
    dangerouslyUseHTMLString: dangerouslyUseHTMLString || true,
    type: type || 'warning',
    duration: 2000,
    showClose: showClose || true
  })
}


// 防抖
// const p = ''

// const onkeyup=()=>{
//     if(p){
//         clearInterval(p)
//     }
//     p = setTimeout(() => {
//         console.log(需要执行的代码);
//     }, 2000);
// }


// const q = ''
// const ketup=()=>{
//     if(q){
//         return
//     }
//     q=setTimeout(() => {
//         console.log(节流需要执行的代码);
//         q=null
//     }, 2000);
// }


export const showModel = (title, content, type) => {
  return ElMessageBox.confirm(
    content,
    title,
    {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: type || 'warning',
    }
  )
}

